package com.swanclouds.redfish.account.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.swanclouds.model.account.IBMCUserGroup;

import java.util.List;

/**
 * 用户组信息
 * @author 张立强
 * @version jdk1.8.0
 */
public class IBMCUserGroupModel implements IBMCUserGroup {

    @JsonProperty("IsPredefined")
    private Boolean predefined;

    @JsonProperty("AssignedPrivileges")
    private List<String> assignedPrivileges;

    @JsonProperty("RoleId")
    private String roleId;

    @JsonProperty("OemPrivileges")
    private List<String> oemPrivileges;

    @JsonProperty("@odata.id")
    private String dataId;

    @JsonProperty("@odata.context")
    private String context;

    @JsonProperty("@odata.type")
    private String type;

    @JsonProperty("Id")
    private String id;

    @JsonProperty("Name")
    private String name;
    /**
     * 角色是否预定义
     *
     * @return IsPredefined
     */
    @Override
    public Boolean isPredefined() {
        return this.predefined;
    }

    /**
     * Redfish 定义的权限类型
     *
     * BMC: ConfigureComponents,ConfigureManager,ConfigureUsers,ConfigureSelf,Login
     * ConfigureComponents:常规配置,ConfigureManager:管理配置,ConfigureUsers:用户配置,ConfigureSelf:配置自身,Login:登录
     *
     *
     * Huawei: ConfigureComponents,ConfigureUsers,ConfigureSelf,Login
     * ConfigureComponents:常规配置,ConfigureUsers:用户配置,ConfigureSelf:配置自身,Login:登录
     *
     * @return java.util.List&lt;String&gt;
     */
    @Override
    public List<String> getAssignedPrivileges() {
        return this.assignedPrivileges;
    }

    /**
     * 服务器自定义的权限类型
     *
     * BMC: SNMP,Vmedia,KVM
     *
     * Huawei: OemKvm,OemVmm,OemSecurityMgmt,OemPowerControl,OemDiagnosis
     * OemKvm：远程控制,OemVmm：远程媒体,OemSecurityMgmt：安全配置,OemPowerControl：电源控制,OemDiagnosis：调试诊断
     *
     * @return java.util.List&lt;String&gt;
     */
    @Override
    public List<String> getOemPrivileges() {
        return this.oemPrivileges;
    }

    /**
     * 用户组角色信息，包括： Administrator  Operator  User  None  Oem
     *
     * @return RoleId;
     */
    @Override
    public String getRoleId() {
        return this.roleId;
    }

    /**
     * 系统资源的访问路径
     *
     * @return dataId
     */
    @Override
    public String getDataId() {
        return this.dataId;
    }

    /**
     * 系统资源模型的OData描述信息
     *
     * @return context
     */
    @Override
    public String getContext() {
        return this.context;
    }

    /**
     * 系统资源的类型
     *
     * @return type
     */
    @Override
    public String getType() {
        return this.type;
    }

    /**
     * 系统资源的ID
     *
     * @return Id
     */
    @Override
    public String getId() {
        return this.id;
    }

    /**
     * 系统资源的名称
     *
     * @return Name
     */
    @Override
    public String getName() {
        return this.name;
    }


    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
        }
        return "IBMCUserGroupModel {" +
                "predefined=" + predefined +
                ", assignedPrivileges=" + assignedPrivileges +
                ", oemPrivileges=" + oemPrivileges +
                ", dataId='" + dataId + '\'' +
                ", context='" + context + '\'' +
                ", type='" + type + '\'' +
                ", id='" + id + '\'' +
                ", name='" + name + '\'' +
                '}';
    }
}
